package com.weds.edjk.web;

import com.alibaba.fastjson.JSONObject;
import com.weds.core.annotation.Logs;
import com.weds.core.base.BaseController;
import com.weds.edjk.service.KtRecordService;
import com.weds.edjk.service.UserMonitorService;
import com.weds.edjk.vo.RespMqttVo;
import com.weds.edjk.vo.VisUserVo;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author zcz
 * @Description 人员信息
 * @Date 2020-6-20
 */
@RestController
@RequestMapping(value = "/user/monitor")
@Api(value = "人员信息", description = "人员信息")
public class UserMonitorController extends BaseController {
    private Logger log = LogManager.getLogger();
    @Autowired
    KtRecordService ktRecordService;
    @Autowired
    UserMonitorService userMonitorService;

    /**
     * 查询访客详情
     * @param jo
     * @return
     */
    @Logs
    @PostMapping(value = "/vis")
    public VisUserVo getVis(@RequestBody RespMqttVo jo){
        JSONObject data = jo.getData();
        if(null == data || StringUtils.isEmpty(data.get("serial")+"")){
            return new VisUserVo();
        }
        return userMonitorService.selectVisUserDetailByVisSerial(data.get("serial")+"");
    }
}